import { defineStore } from 'pinia'
import { useMovieStore } from '../movie'

export const useUserStore = defineStore({
    id: 'user', // id必填，且需要唯一
    state: () => {
        return {
            name: '大菠萝',
            count: 0
        }
    },
    getters: {
        getCountBuff(state) {
            console.log('state.count被调用')
            return `${state.name}***${state.name}`
        },
        getMovieList(): string[] {
            return useMovieStore().movieList
        }
    },
    actions: {
        changeNameCount(name: string, count: number) {
            this.name = name
            this.count = count
        }
    }
})
